//
//  StatusView.m
//  cliqset
//
//  Created by David Hinson on 3/4/09.
//  Copyright 2009 Cliqset, Inc.. All rights reserved.
//

#import "StatusView.h"
#import "ProfileViewController.h"
#import "cliqsetAppDelegate.h"

@implementation StatusView

@synthesize statusField;
@synthesize parent;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
}

// Do Status
-(IBAction)doStatus:(id)id {	
	cliqsetAppDelegate* myApp = (cliqsetAppDelegate*)[[UIApplication sharedApplication] delegate];
	
	ProfileViewController * myParent = (ProfileViewController*)self.parent;
	[self.statusField resignFirstResponder];

	[myParent showStatusView:NO];	
	
	NSDate * tsDate   = [myApp dateFromISO8601:nil];
	[myParent setHeaderStatus:self.statusField.text timeStamp:tsDate];
	
	[myApp.cliqset putCurrentStatus:self.statusField.text];
}

// Do Cancel

-(IBAction)doCancel:(id)id {
	ProfileViewController * myParent = (ProfileViewController*)self.parent;
	[self.statusField resignFirstResponder];
	[myParent showStatusView:NO];
}

- (void)dealloc {
	[parent release];
	[statusField release];
    [super dealloc];
}


@end
